<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Python Opcodes</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="PartOpcodesOverview.html" title="Part II. Opcodes Overview" />
    <link rel="prev" href="lua.html" title="Lua Opcodes" />
    <link rel="next" href="PythonOpcodesSyntax.html" title="Orchestra Syntax" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Python Opcodes</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="lua.html">Prev</a> </td>
          <th width="60%" align="center">Part II. Opcodes Overview</th>
          <td width="20%" align="right"> <a accesskey="n" href="PythonOpcodesSyntax.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="chapter">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title"><a id="py"></a>Python Opcodes</h2>
          </div>
        </div>
      </div>
      <div class="section">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title" style="clear: both"><a id="PythonOpcodes"></a>Introduction</h2>
            </div>
          </div>
        </div>
        <p>Using the Python opcode family, you can interact with a Python interpreter embedded in Csound in five ways:</p>
        <div class="orderedlist">
          <ol class="orderedlist" type="1">
            <li class="listitem">Initialize the Python interpreter (the <a class="link" href="pyinit.html" title="pyinit Opcodes"><em class="citetitle">pyinit</em></a> opcodes),</li>
            <li class="listitem">Run a statement (the <a class="link" href="pyrun.html" title="pyrun Opcodes"><em class="citetitle">pyrun</em></a> opcodes),</li>
            <li class="listitem">Execute a script (the <a class="link" href="pyexec.html" title="pyexec Opcodes"><em class="citetitle">pyexec</em></a> opcodes),</li>
            <li class="listitem">Invoke a callable and pass arguments (the <a class="link" href="pycall.html" title="pycall Opcodes"><em class="citetitle">pycall</em></a> opcodes),</li>
            <li class="listitem">Evaluate an expression (the <a class="link" href="pyeval.html" title="pyeval Opcodes"><em class="citetitle">pyeval</em></a> opcodes), or</li>
            <li class="listitem">Change the value of a Python object, possibly creating a new
      Python object (the <a class="link" href="pyassign.html" title="pyassign Opcodes"><em class="citetitle">pyassign</em></a> opcodes);</li>
          </ol>
        </div>
        <p>and you can do any of these things:</p>
        <div class="orderedlist">
          <ol class="orderedlist" type="1">
            <li class="listitem">At i-time or at k-time,</li>
            <li class="listitem">In the global Python namespace, or in a namespace specific
      to an individual instance of a Csound instrument (local or "l" context),</li>
            <li class="listitem">And can you can retrieve from 0 to 8 return values from
      callables that accept N parameters.</li>
          </ol>
        </div>
        <p>...this means that there are many Python-related opcodes. But
    all of these opcodes share the same <span class="emphasis"><em>py</em></span> prefix, and have a regular
    naming scheme:</p>
        <pre class="programlisting">
"py" + [optional context prefix] + [action name] + [optional x-time suffix]</pre>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="lua.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="PartOpcodesOverview.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="PythonOpcodesSyntax.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">
        Lua Opcodes
     </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Orchestra Syntax</td>
        </tr>
      </table>
    </div>
  </body>
</html>
